package com.wcc.mpmultidb;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

@SpringBootApplication(scanBasePackages = "com.wcc.mpmultidb")
@MapperScan("com.wcc.mpmultidb.dao.*")
public class MpMultidbApplication implements CommandLineRunner {


//    @Autowired
//    DataSource dataSource;

    public static void main(String[] args) {
        SpringApplication.run(MpMultidbApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
/*        DynamicRoutingDataSource dataSource2 = (DynamicRoutingDataSource) dataSource;
        ItemDataSource master =(ItemDataSource) dataSource2.getDataSource("master"); //主库
        ItemDataSource slave =(ItemDataSource) dataSource2.getDataSource("slave"); //从库
        System.out.println(master.getClass());*/
    }
}
